package com.tsd.system.service;

import com.tsd.core.vo.PageBean;
import com.tsd.system.entity.SysRole;
import com.tsd.system.entity.SysRoleExt;
import com.tsd.system.entity.SysUser;
import com.tsd.system.entity.SysUserExt;

import java.util.List;
import java.util.Map;


/**
 * 描述：SysRole服务实现层接口
 *
 * @author Hillpool
 * @date 2019/03/12 12:20:51
 */
public interface SysRoleService {

    /**
     * 描述：根据id获取SysRole
     *
     * @param id
     */
    SysRole getSysRoleById(Long id) throws Exception;

    SysRoleExt queryBySid(String sid) throws Exception;

    /**
     * 描述：保存或更新SysRole
     *
     * @param record
     * @param opUser
     */
    void saveSysRole(SysRoleExt record, SysUser opUser) throws Exception;

    /**
     * 描述：根据id删除SysRole
     *
     * @param id
     */
    void deleteSysRole(Long id, SysUser sysUser) throws Exception;

    /**
     * 描述：根据ids删除SysRole
     *
     * @param ids
     */
    void batchDelSysRole(List<Long> ids, SysUser opUser) throws Exception;

    /**
     * 描述：根据params分页查询SysRole
     *
     * @param params
     * @param page
     */
    List<SysRoleExt> findSysRoles(Map<String, Object> params, PageBean page) throws Exception;

    List<SysRoleExt> findSysRoles(Map<String, Object> params) throws Exception;

    List<SysRoleExt> listSysRole(Map<String, Object> params, PageBean page) throws Exception;

    /**
     * @deccript(描述): 获取SysRole树
     * @param(参数):
     * @return(返回值):
     */
    List<SysRoleExt> findSysRoleTree(String groupId) throws Exception;

    /**
     * @deccript(描述): 根据单位类型获取角色列表
     * @param(参数):
     * @return(返回值):
     */
    List<SysRoleExt> findRoleByUnitType(String orgTypeSid) throws Exception;


    List<Map<String, Object>> findParamsMapByPage(Map<String, Object> params, PageBean page) throws Exception;


    /**
     * 批量删除SysRole
     *
     * @param ids
     * @param opUser
     * @throws Exception
     */
    void batchDeleteSysRole(List<Long> ids, SysUser opUser) throws Exception;

    List<SysRoleExt> findRoleListByUserId(Map<String, Object> params) throws Exception;


    /**
     * 保存用户
     *
     * @param t
     * @param sysUser
     * @param user_sid_list
     */
    void saveSysUserRoleList(SysRoleExt t, SysUser sysUser, List<String> user_sid_list) throws Exception;

    List<SysRoleExt> query4ShiroAuthorizationInfo(SysUserExt userExt) throws Exception;

    /**
     * 初始化角色（all，所有功能），并赋予给user
     * @param user
     * @throws Exception
     */
    void initRoleAll(SysUserExt user) throws Exception;
}
